/*
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements.  See the NOTICE file distributed with
 *   this work for additional information regarding copyright ownership.
 *   The ASF licenses this file to You under the Apache License, Version 2.0
 *   (the "License"); you may not use this file except in compliance with
 *   the License.  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */

package com.citycloud.datac.client.properties;

import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.citycloud.datac.client.configuration.DataCOAuth2ClientConfiguration;

/**
 * oauth2异常配置信息
 */
@AutoConfigureBefore(DataCOAuth2ClientConfiguration.class)
@Configuration
public class SecurityConfiguration {

	/**
	 * oauth2的client配置
	 */
	@ConfigurationProperties(prefix = "security.oauth2.client")
	@Bean
	public SecurityConfigurter.SecurityClientConfig securityOauth2ClientConfig() {
		return new SecurityConfigurter.SecurityClientConfig();
	}

	/**
	 * oauth2的resource配置
	 *
	 * @return
	 */
	@ConfigurationProperties(prefix = "security.oauth2.resource")
	@Bean
	public SecurityConfigurter.SecurityResourceConfig securityOauth2ResourceConfig() {
		return new SecurityConfigurter.SecurityResourceConfig();
	}

	@ConfigurationProperties(prefix = "security.oauth2.filter")
	@Bean
	public SecurityConfigurter.SecurityFilter filterConfig() {
		return new SecurityConfigurter.SecurityFilter();
	}
}
